#ifndef TERM_H_
#define TERM_H_

#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include "../../Exception/GA_Exception.h"

using std::vector;
using std::string;
using std::ostringstream;

/** Contains functionality for a single term in a multivariable polynomial.  A term includes
 * a coefficient and power and can be evaluated given values for its variables.
 */
template <typename T>
class Term
{
    public:
        Term();
        Term(T, vector<double>);     /*!< Constructor allowing prebuilt data members                         */
        double evaluate(vector<T>);  /**< Evaluates the term based on the given variable values              */
        T getCoefficient();          /**< Returns the coefficient associated with this term                  */
        vector<double> getPowers();  /**< Returns the powers associated with this term                       */
        string toString();           /**< Returns the term in human readable string-format                   */
        string toString(vector<T>);  /**< Returns the term in string format with values instead of variables */
        
    private:
        T coefficient;
        std::vector<double> powers;
};

#endif /*TERM_H_*/
